from django.shortcuts import render,HttpResponse

# Create your views here.
## 在 URL 中携带参数
## 1、通过 查询字符串(query string) : https://www.baidu.com/s?wd=python&a=1&b=2
## 2、在 path 中携带： http://127.0.0.1:8000/book?id=3

## 1、查询字符串 http://127.0.0.1:8000/book?id=3

#http://127.0.0.1:8000/book?id=8&name="三国"
def book_detail_query_string(request):
    book_id = request.GET.get("id")
    name = request.GET.get('name')
    return HttpResponse(f"你要查找的图书ID是：{book_id},图书名称是：{name}")

# http://127.0.0.1:8000/book/99
def book_detail_path(request,book_id):
    return HttpResponse(f"你要查找的图书ID是：{book_id}")

def book_detail_str(request,book_id):
    return HttpResponse(f"你要查找的图书ID是：{book_id}")

def book_detail_slug(request,book_id):
    return HttpResponse(f"你要查找的图书ID是：{book_id}")

def book_detail_path(request,book_id):
    return HttpResponse(f"你要查找的图书ID是：{book_id}")